<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<meta name="viewport"
			content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
		<title>我的企业</title>
		<link rel="stylesheet" href="/mobile/layui/css/layui.css" />
		<link rel="stylesheet" href="/mobile/css/mobile.css" />
		<script src="/mobile/js/jquery.min.js"></script>
		<script src="/mobile/js/jquery.easing.min.js"></script>
		<script src="/mobile/layui/layui.js"></script>

	</head>
	<body style="background:#f5f5f5;">
		
		<div class="qiye_xiangqing" style="background:#fff;">
			<div class="hd">
				<img src="{$qiye.image}">
				<div class="title">
				    <h3 style="margin-bottom:15px;">{$qiye.name}</h3>
				    <div style="display:flex;justify-content:space-between; font-weight:normal; font-size:13px;">
				        <span style="color:#999;margin-right:25px;">企业编号:{$qiye.randomid}</span>
				        <a style="color:#214194; width:156px;" href="{:url('qiye/detail',['id'=>$qiye.id])}">查看详情>></a>
				    </div>
				</div>
			</div>
		</div>
		<div class="gap"></div>
        <div class="layui-tab layui-tab-brief" >
		  <ul class="layui-tab-title" style="background:#fff;">
		    <li class="layui-this">待上架</li>
		    <li>待审核</li>
		    <li>已上架</li>
		  </ul>
          <div class="layui-tab-content">
              <div class="layui-tab-item layui-show">
                  <ul class="chanpin_list">
                      {volist name="product" id="item"}
                          {if($item.status=='1')}
                          <li>
                              <div class="bd">
                                  <div class="img"><img src="{$item.image}" /></div>
                                  <div class="content">
                                      <h6 class="title">{$item.name}</h6>
                                      <p class="desc"><span>产品ID:</span>{$item.randomid}</p>
                                      <p class="desc"><span>提交时间:</span>{$item.updatetime|date="Y-m-d",###}</p>
                                  </div>
                              </div>
                              <div class="ft">
                                  <a onclick="shanchu({$item.id})" class="layui-btn layui-btn-sm layui-btn-normal layui-btn-radius">删除</a>
                                  <a href="{:url('user/product_edit',['id'=>$item.id])}" class="layui-btn layui-btn-sm layui-btn-normal layui-btn-radius">编辑</a>
                                  <a href="{:url('product/detail',['id'=>$item.id])}" class="layui-btn layui-btn-sm layui-btn-normal layui-btn-radius">查看详情</a>
                              </div>
                          </li>
                          {/if}
                      {/volist}
                  </ul>
              </div>    
              <div class="layui-tab-item">
                  <ul class="chanpin_list">
                      {volist name="product" id="item"}
                          {if($item.status=='0')}
                          <li>
                              <div class="bd">
                                  <div class="img"><img src="{$item.image}" /></div>
                                  <div class="content">
                                      <h6 class="title">{$item.name}</h6>
                                      <p class="desc"><span>产品ID:</span>{$item.randomid}</p>
                                      <p class="desc"><span>提交时间:</span>{$item.updatetime|date="Y-m-d",###}</p>
                                  </div>
                              </div>
                              <div class="ft">
                                  
                                  <a href="{:url('product/detail',['id'=>$item.id])}" class="layui-btn layui-btn-sm layui-btn-normal layui-btn-radius">查看详情</a>
                              </div>
                          </li>
                          {/if}
                      {/volist}
                  </ul>
              </div>
              <div class="layui-tab-item">
                  <ul class="chanpin_list">
                      {volist name="product" id="item"}
                          {if($item.status=='2')}
                          <li>
                              <div class="bd">
                                  <div class="img"><img src="{$item.image}" /></div>
                                  <div class="content">
                                      <h6 class="title">{$item.name}</h6>
                                      <p class="desc"><span>产品ID:</span>{$item.randomid}</p>
                                      <p class="desc"><span>提交时间:</span>{$item.updatetime|date="Y-m-d",###}</p>
                                  </div>
                              </div>
                              <div class="ft">
                                  <a onclick="xiajia({$item.id})" class="layui-btn layui-btn-sm layui-btn-normal layui-btn-radius">下架</a>
                                  <a href="{:url('product/detail',['id'=>$item.id])}" class="layui-btn layui-btn-sm layui-btn-normal layui-btn-radius">查看详情</a>
                              </div>
                          </li>
                          {/if}
                      {/volist}
                  </ul>
              </div>
          </div>      
        </div>     
	    <div style="height:64px;"></div>
	    <div style="position:fixed;bottom:0;left:0;right:0; padding:10px 15px;">
	        <a href="{:url('user/product_add')}" class="layui-btn layui-btn-lg layui-btn-fluid layui-btn-normal layui-btn-radius">新增产品</a>
	    </div>
	</body>
<script>
function xiajia(id){
    layer.confirm('确定下架吗?', {icon: 3, title:'提示'}, function(index){
      // do something
      $.ajax({
		      type:"POST",
		      url:"/api.php/index/product_xiajia",
		      dataType:"json",
		      data:{
		          "id":id,
		          
		      },
		      success:function(res){
		          console.log(res);
		          if(res.code==0){
		              layer.msg(res.msg,{icon:5});

		          }else{
		              layer.msg(res.msg,{icon:6},function(){

						  window.location.reload();
		              });
		          }
		      }
		  });
      layer.close(index);
    });
}

function shanchu(id){
    layer.confirm('确定删除吗?', {icon: 3, title:'提示'}, function(index){
      // do something
      $.ajax({
		      type:"POST",
		      url:"/api.php/index/product_shanchu",
		      dataType:"json",
		      data:{
		          "id":id,
		          
		      },
		      success:function(res){
		          console.log(res);
		          if(res.code==0){
		              layer.msg(res.msg,{icon:5});

		          }else{
		              layer.msg(res.msg,{icon:6},function(){

						  window.location.reload();
		              });
		          }
		      }
		  });
      layer.close(index);
    });
}
</script>	
</html>